<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Send an HTML error message to the client</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="eventhttprequest.removeheader.html">EventHttpRequest::removeHeader</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="eventhttprequest.sendreply.html">EventHttpRequest::sendReply</a></div>
 <div class="up"><a href="class.eventhttprequest.html">EventHttpRequest</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="eventhttprequest.senderror" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">EventHttpRequest::sendError</h1>
  <p class="verinfo">(PECL event &gt;= 1.4.0-beta)</p><p class="refpurpose"><span class="refname">EventHttpRequest::sendError</span> &mdash; <span class="dc-title">Send an HTML error message to the client</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-eventhttprequest.senderror-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type"><span class="type void">void</span></span> 
   <span class="methodname"><strong>EventHttpRequest::sendError</strong></span>
    ( <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$error</code>
   </span>
   [, <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$reason</code>
    <span class="initializer"> = <strong><code>NULL</code></strong></span>
   </span>
  ] )</div>

  <p class="para rdfs-comment">
   Send an HTML error message to the client.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-eventhttprequest.senderror-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>

     <em><code class="parameter">error</code></em>
    </dt>

    <dd>

     <p class="para">
      The HTTP error code.
     </p>
    </dd>

   
   
    <dt>

     <em><code class="parameter">reason</code></em>
    </dt>

    <dd>

     <p class="para">
      A brief explanation ofthe error. If <strong><code>NULL</code></strong>, the standard meaning of the
      error code will be used.
     </p>
    </dd>

   
  </dl>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-eventhttprequest.senderror-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-eventhttprequest.senderror-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4179">
   <p><strong>Example #1 
    <span class="function"><strong>EventHttpRequest::sendError()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">_http_400</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$req</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sendError</span><span style="color: #007700">(</span><span style="color: #0000BB">400</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">$base&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EventBase</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$http&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EventHttp</span><span style="color: #007700">(</span><span style="color: #0000BB">$base</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$http</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setCallback</span><span style="color: #007700">(</span><span style="color: #DD0000">"/err400"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"_http_400"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$http</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bind</span><span style="color: #007700">(</span><span style="color: #DD0000">"0.0.0.0"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">8010</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$base</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">loop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

 <div class="refsect1 seealso" id="refsect1-eventhttprequest.senderror-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member">
    <span class="methodname"><a href="eventhttprequest.sendreply.html" class="methodname" rel="rdfs-seeAlso">EventHttpRequest::sendReply()</a> - Send an HTML reply to the client</span>
   </li>
  </ul>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="eventhttprequest.removeheader.html">EventHttpRequest::removeHeader</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="eventhttprequest.sendreply.html">EventHttpRequest::sendReply</a></div>
 <div class="up"><a href="class.eventhttprequest.html">EventHttpRequest</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
